<?php
/**
 * @var $schoolsList
 * @var $cityList
 * @var $provinceId
 * @var $weekHotSchool
 * @var $jobCate
 * @var $hotWeekJobCate
 * @var $currentCity
 */
$currentCityName = $this->request->getParam('cityName',false);
$currentProvinceName = $this->request->getParam('provinceName',false);
?>
<div class="mainJobs mainWith">
    <div class="schoolHeader clearFix">
        <div class="schoolLocation">
            <?php if($currentCityName){
                ?>
                当前位置：首页 > 全国 > <a href="/school/<?php echo $provinceId->first()->name_py?>"><?php echo $provinceId->first()->name?></a> <?php if($currentCityName){ echo ' > '.'<a href="'.$currentCity->name_py.'">'.$currentCity->name.'</a>'; }?> > <span>学校招聘信息</>
                <?php
            } else {
                ?>
                当前位置：首页 > 全国 > <a href="<?php echo $provinceId->first()->name_py?>"><?php echo $provinceId->first()->name?></a> > <span>学校招聘信息</>
            <?php
            }?>
        </div>
        <div class="schoolSearch">
            <div class="schoolInputWrap">
                <form action="" method="post" id="schoolSearch" onsubmit="return false">
                    <input type="text" placeholder="请输入学校名称">
                    <button class="schoolStartSearch" type="submit">搜索</button>
                </form>
            </div>
        </div>
    </div>
    <div class="schoolLocationList clearFix">
        <div class="schoolLocationListWrap clearFix">
            <div class="locationLabel">
                地区
            </div>
            <div class="province">
                <a href="/school" class="<?php echo !$currentCityName && !$currentProvinceName?'selectLocation':''?>">全国</a>
<!--                <a href="/school/--><?php //echo $provinceId->first()->name_py?><!--" class="--><?php //echo !$currentCityName?'selectLocation':''?><!--">--><?php //echo $provinceId->first()->name?><!--</a>-->
                <?php foreach ($cityList as $item){
                    ?>
                    <a href="/school/<?php echo $provinceId->first()->name_py?>/<?php echo $item->name_py?>" class="<?php echo ((!$currentCityName?$currentProvinceName:$currentCityName) === $item->name_py?'selectLocation':'')?>"><?php echo $item->name?></a>
                    <?php
                }?>
            </div>
        </div>
        <div class="schoolContentWrap clearFix">
            <div class="latestSchool">
                <div class="latestSchoolLabel">
                    最新学校
                </div>
                <div class="latestSchoolList">
                    <?php foreach ($schoolsList as $item){
                        ?>
                        <div class="latestSchoolDetail">
                            <div class="latestSchoolDetailTop clearFix">
                                <div class="latestSchoolName">
                                    <a href="/school/<?php echo $item->id?>.html" title="<?php echo $item->title?>"><?php echo $item->title?></a>
                                </div>
                                <div class="latestSchoolLocationAndNature">
                                    <div class="latestSchoolLocation">
                                        地区：<span><?php echo $item->location?></span>
                                    </div>
                                    <div class="latestSchoolNature">
                                        性质：<span><?php echo $item->type?></span>
                                    </div>
                                </div>
                            </div>
                            <div class="latestSchoolDetailBottom clearFix">
                                <p class="employeeIntro">正在招聘<span class="employeeNum"><?php echo count($item->jobs)?></span>个职位：</p>
                                <div class="employeePosition">
                                    <?php foreach ($item->jobs as $job) {
                                        ?>
                                        <span>
                                            <a href="/jobs/<?php echo $jobCate[$item->id][$job->id]->name_py?>/<?php echo $job->id?>.html" title="<?php echo $job->name?>">
                                                <?php echo $job->name?>
                                            </a>
                                        </span>&nbsp;
                                        <?php
                                    }?>
                                </div>
                            </div>
                        </div>
                        <?php
                    }?>
                    <?php if($schoolsList->count() === 0){
                        ?>
                        <p style="font-size: 18px;text-align: center;margin: 30px 0 0 0;">暂无数据</p>
                        <?php
                    }?>
                </div>
                <div class="page-wrapper">
                    <!--分页代码-->
                    <?php
                        if(!$this->request->getParam('cityName',false)){
                            $url = '/school/'.$this->request->getParam('provinceName').'/p';
                        } else {
                            $url = '/school/'.$this->request->getParam('provinceName').'/'.$this->request->getParam('cityName').'/p';
                        }
                        echo $this->element('paginator', [  "url" => $url ]);
                    ?>
                </div>
            </div>
            <div class="weekHotSchool">
                <div class="latestSchoolLabel">
                    本周热门学校
                </div>
                <div class="weekHotSchoolList">
                    <?php foreach ($weekHotSchool as $key=>$item){
                        if ($key <= 2) {
                            ?>
                            <div class="weekHotSchoolDetail">
                                <div class="weekHotSchoolName">
                                    <a href="/school/<?php echo $item->id?>.html"><?php echo $item->title?></a>
                                </div>
                                <div class="weekHotSchoolEmployee">
                                    招聘<span class="weekHotEmployeeNum"><?php echo count($item->jobs)?></span>
                                    个职位：
                                    <?php if(count($item->jobs)>0){
                                        ?>
                                        <a href="/jobs/<?php echo $hotWeekJobCate[$item->id][$item->jobs[0]->id]->name_py?>/<?php echo $item->jobs[0]->id?>.html">
                                            <span class="weekHotSchoolPosition"><?php echo $item->jobs[0]->name?></span>
                                        </a>等
                                    <?php
                                    } else {
                                        ?>
                                        暂无岗位
                                    <?php
                                    }?>
                                </div>
                                <div class="weekHotSchoolTopRank">
                                    <img src="/img/top<?php echo $key+1?>.png" alt="排名第一">
                                </div>
                            </div>
                        <?php } else {
                            ?>
                            <div class="weekHotSchoolDetail">
                                <div class="weekHotSchoolName">
                                    <a href="/school/<?php echo $item->id?>.html"><?php echo $item->title?></a>
                                </div>
                                <div class="weekHotSchoolEmployee">
                                    招聘<span class="weekHotEmployeeNum"><?php echo count($item->jobs)?></span>
                                    个职位：
                                    <?php if(count($item->jobs)>0){
                                        ?>
                                        <a href="/jobs/<?php echo $hotWeekJobCate[$item->id][$item->jobs[0]->id]->name_py?>/<?php echo $item->jobs[0]->id?>.html">
                                            <span class="weekHotSchoolPosition"><?php echo $item->jobs[0]->name?></span>
                                        </a>等
                                        <?php
                                    } else {
                                        ?>
                                        暂无岗位
                                        <?php
                                    }?>
                                </div>
                            </div>
                            <?php
                        }
                    }?>
                </div>
            </div>
        </div>
    </div>
</div>
